package top.infopub.job.quartz.exec;


import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import top.infopub.job.mkt.service.BidOpenResultService;
import top.infopub.job.quartz.exec.base.BaseJob;
import top.infopub.util.DateUtil;
import top.infopub.util.SpringContext;


/**
 * 市场开标结果，把满足条件的标进行开标
 *
 */
public class BidOpenResultJob extends BaseJob {

    private static BidOpenResultService bidOpenResultService;

    static {
        bidOpenResultService = SpringContext.getBean(BidOpenResultService.class);
    }

    public BidOpenResultJob() {}

    @Override
    public void execute(JobExecutionContext context)
        throws JobExecutionException {
        try {
            String start = DateUtil.currentDateDef();
            log.info("BidOpenResultJob开始时间：{}", start);
            bidOpenResultService.openBid();
            String end = DateUtil.currentDateDef();
            log.info("BidOpenResultJob结束时间：{}", end);
            logSucceed("开标任务执行完成，开始时间：" + start + "，结束时间：" + end);
        }
        catch (Exception e) {
            log.error("开标任务执行error", e);
            logFail(e, true);
        }
    }
}
